package srvhandler

import (
	"context"
	"zg4zk3/srv/client"
	"zg4zk3/srv/dao"
	__ "zg4zk3/srv/proto"
)

// server is used to implement helloworld.GreeterServer.
type Servers struct {
	__.UnimplementedUserServer
}

func (s *Servers) List(_ context.Context, req *__.ListRequest) (*__.ListResponse, error) {

	var good []client.Goods
	dao.List(&good)
	return &__.ListResponse{
		Id:    req.Id,
		Name:  req.Name,
		Sum:   req.Sum,
		Price: req.Price,
	}, nil

}
func (s *Servers) Show(_ context.Context, req *__.ShowRequest) (*__.ShowResponse, error) {
	var good client.Goods
	dao.Show(uint(req.Id), &good)
	return &__.ShowResponse{Id: "1"}, nil
}
